#!/bin/bash

echo "🔍 AutoCost 项目状态检查"
echo "========================"

# 检查 Node.js 版本
echo "📋 环境检查:"
node_version=$(node -v)
echo "✅ Node.js: $node_version"

npm_version=$(npm -v)
echo "✅ npm: $npm_version"

# 检查依赖
echo ""
echo "📦 依赖检查:"
if [ -d "node_modules" ]; then
    echo "✅ node_modules 存在"
else
    echo "❌ node_modules 不存在，请运行 npm install"
    exit 1
fi

# 检查关键文件
echo ""
echo "📁 文件检查:"
files=("App.tsx" "package.json" "tsconfig.json" "babel.config.js" "tailwind.config.js")
for file in "${files[@]}"; do
    if [ -f "$file" ]; then
        echo "✅ $file"
    else
        echo "❌ $file 缺失"
    fi
done

# 检查 src 目录结构
echo ""
echo "📂 源码目录检查:"
src_dirs=("src/screens" "src/components" "src/navigation" "src/utils" "src/types" "src/styles")
for dir in "${src_dirs[@]}"; do
    if [ -d "$dir" ]; then
        echo "✅ $dir"
    else
        echo "❌ $dir 缺失"
    fi
done

# 检查 TypeScript 配置
echo ""
echo "🔧 TypeScript 检查:"
if npx tsc --noEmit > /dev/null 2>&1; then
    echo "✅ TypeScript 配置正确"
else
    echo "❌ TypeScript 配置有问题"
fi

# 检查 ESLint
echo ""
echo "🔍 ESLint 检查:"
if npm run lint > /dev/null 2>&1; then
    echo "✅ ESLint 检查通过"
else
    echo "⚠️  ESLint 发现一些问题"
fi

echo ""
echo "🎯 项目状态: 准备就绪！"
echo "🚀 运行 ./start.sh 启动项目" 